<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head th:replace="common/form :: head"></head>
	<body class="mainbody">
		<form method="POST" th:object="${obj}" enctype="multipart/form-data">
			<div th:replace="common/form :: location('分享资源管理',*{id} gt 0 ?'修改资源信息':'新增分享资源')"></div>
			<div id="floatHead" class="content-tab-wrap">
			  <div class="content-tab">
			    <div class="content-tab-ul-wrap">
			      <ul>
			        <li><a href="javascript:;">分享信息</a></li>
			      </ul>
			    </div>
			  </div>
			</div>
			<div class="tab-content">
				<dl>
					<dt>分享内容</dt>
				    <dd>
				      <input type="text" th:field="*{describe1}" class="input normal" data-type="*1-100" />
				      <span class="Validform_checktip">*内容不能为空</span>
				    </dd>
				</dl>
				
			<dl>
				 	<dt>分享图片</dt> 
					<dd>
						<input type="file" name="PICN" onchange="previewFile()"/><br/>
						<img th:src="${pro}+*{photo}" height="250px" width="10px" alt="Image preview..." class="input normal"/>
						<span class="Validform_checktip">*请选择分享图片</span>
							<!-- <img  th:src="${pro}+*{photo}" style="position:absolute;left:250px;top:190px" width="120px" height="70px"/> -->
					</dd>
			</dl>
				 
				<dl>
					<dt>分享时间</dt>
				    <dd>
				      <input type="date" th:field="*{shareTime}" class="input normal" data-type="*2-10" />
				      <span class="Validform_checktip">*时间不能为空</span>
				    </dd>
				</dl>
				
				<dl>
					<dt>分享者</dt>
				    <dd>
				    	<span class="rule-multi-porp">
				    		<th:block th:each="employee,employeeStat:${@employeeService.getAllEmployees()}">
				    			<input type="checkbox" th:name="employeeId" th:value="${employee.id}" th:if="${obj.employee  == null}" />
								<input type="checkbox" th:name="employeeId" th:value="${employee.id}" th:if="${obj.employee != null}" th:checked="${obj.employee.id} == ${employee.id}"/>
								<label th:for="'employee['+${employeeStat.count-1}+'].id'" th:text="${employee.name}"></label>
				    		</th:block>
				    	</span>
				    </dd>
				</dl>
				
			</div>
			<div th:replace="common/form :: footer"></div>
		</form>
		<script type="text/javascript" th:replace="common/form :: formscript"></script>
		<script type="text/javascript">
		//图片预览
		function previewFile() {
			 var preview = document.querySelector('img');
			 var file  = document.querySelector('input[type=file]').files[0];
			 var reader = new FileReader();
			 reader.onloadend = function () {
			  preview.src = reader.result;
			 }
			 if (file) {
			  reader.readAsDataURL(file);
			 } else {
			  preview.src = "";
			 }
		}

		
		</script>
	</body>
</html>